﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Agr.CQRS.Infrastructure.ServiceBus;
using Agr.CQRS.Infrastructure.Events;
using Agr.CQRS.Domain.Events;
using Agr.Questionnaire.Core.Domain.Qnnaire.Events;
using Agr.CQRS.Infrastructure.Orm;
using Agr.CQRS.ViewModel;

namespace Agr.Questionnaire.Core.ViewModel.Qnnaire
{
    public class QuestionnaireInListUpdater : ViewModelUpdater<QuestionnaireInList>
    {
        public QuestionnaireInListUpdater(OrmContext ctx)
            : base( ctx)
        {
        }

        private void handle(QuestionnaireNamedEvent ev)
        {
            CurrentRecord.Name = ev.Name;
        }

        private void handle(TextQuestionAddedEvent ev)
        {
            CurrentRecord.NumberOfQuestions += 1;
        }
    }
}
